#!/usr/bin/python
# -*- coding: UTF-8 -*-

from kpautos.engine.case import Case
from kptest.config.enum import DeviceType, HostType, DeviceUtility


class BMC_SSH_03(Case):
    """
        Name:
            BMC_SSH_03
        Label:
            传感器数值检查
        PreCondition:
            1、BMC正常运行
        TestStep:
            1、带外执行ipmcget -t sensor -d list
        ExpectedResult:
            A) 传感器信息显示正常
        Parameters:

        Remark:

    """

    # 测试执行前配置等准备操作
    def pre_test_case(self):
        self.device_dut = self.resource.get_device(device_type=DeviceType.Server, utility=DeviceUtility.DUT)
        self.os_host = self.device_dut.get_host(host_type=HostType.HostOS)
        self.cli_api = self.device_dut.get_api(ns_name="BmcCli")

    # 测试步骤
    def procedure(self):
        self.log_step("1、带外执行ipmcget -t sensor -d list")
        sensor_info = self.cli_api.cli_get_sensor()
        if sensor_info == None:
            raise Exception("带外查询传感器信息失败")
        self.log_info(f"命令的返回值为：{sensor_info}")

    # 测试结束后恢复环境
    def post_test_case(self):
        pass